﻿@using System.Text
@inherits Blazorise.MemoEdit
@if ( ParentIsAddons )
{
    <span class="@AddonClassNames">
        @InputElement
    </span>
}
else
{
    <div class="@InputClassNames">
        @InputElement
    </div>
}
@ChildContent
@Feedback
@code {
    private RenderFragment InputElement => __builder =>
    {
        @if ( IsImmediate && IsDebounce )
        {
            <textarea @ref="@ElementRef" id="@ElementId" name="@NameAttributeValue" class="@ClassNames" style="@StyleNames" placeholder="@Placeholder" disabled="@Disabled" readonly="@ReadOnly" data-pattern="@Pattern" maxlength="@MaxLength" rows="@Rows" tabindex="@TabIndex" value="@CurrentValue" @onchange="@OnChangeHandler" @oninput="@OnInputHandler" @onkeydown="@OnKeyDownHandler" @onkeypress="@OnKeyPressHandler" @onkeyup="@OnKeyUpHandler" @onblur="@OnBlurHandler" @onfocus="@OnFocusHandler" @onfocusin="@OnFocusInHandler" @onfocusout="@OnFocusOutHandler" @attributes="@Attributes" />
        }
        else
        {
            <textarea @ref="@ElementRef" id="@ElementId" name="@NameAttributeValue" class="@ClassNames" style="@StyleNames" placeholder="@Placeholder" disabled="@Disabled" readonly="@ReadOnly" data-pattern="@Pattern" maxlength="@MaxLength" rows="@Rows" tabindex="@TabIndex" @bind-value="CurrentValueAsString" @bind-value:event="@BindValueEventName" @onkeydown="@OnKeyDownHandler" @onkeypress="@OnKeyPressHandler" @onkeyup="@OnKeyUpHandler" @onblur="@OnBlurHandler" @onfocus="@OnFocusHandler" @onfocusin="@OnFocusInHandler" @onfocusout="@OnFocusOutHandler" @attributes="@Attributes" />
        }
    };
}